package part1.practise_dip;

/**
 * Created by lie on 2018/3/26.
 * @see MyAplication 是顶层
 * @see MyDialogs 是下层
 *
 * @see MyAplication#showDialogs() 对下层的方法进行调用
 * @see MyDialogs#askAppToSayHi() 但同时下层也对上层方法进行了调用
 *
 * 这样就形成了闭环
 */
public class Circle {
    public static void main(String[] args){
        MyAplication.showDialogs();
        MyDialogs.askAppToSayHi();
    }
}

//顶级
class MyAplication{
    public static void sayHi(){
        System.out.println("application say hi");
    }

    public static void showDialogs(){
        MyDialogs.show();
    }
}

//子级
class MyDialogs{
    public static void show(){
        System.out.println("dialog show");
    }

    public static void askAppToSayHi(){
        MyAplication.sayHi();
    }

}
